import { createStore } from 'vuex'
import createPersistedState from "vuex-persistedstate";
export default createStore({
  plugins: [createPersistedState()],
  state: {
    account: Object,
    token: String,
    breadcrumb:Object
  },
  mutations: {
    setAccountMutations(state, payload) {
      state.account = payload;
    },
    setTokenMutations(state, payload) {
      state.token = payload;
    },
    setBreadcrumbMutations(state, payload) {
      state.breadcrumb = payload;
    },
  },
  actions: {
    setAccount({commit}, payload) {
      commit('setAccountMutations', payload);
    },
    setToken({commit}, payload) {
      commit('setTokenMutations', payload);
    },
    setBreadcrumb({commit}, payload) {
      commit('setBreadcrumbMutations', payload);
    },
  },
  getters: {
    getAccount(state) {
      return state.account;
    },
    getToken(state) {
      return state.token;
    },
    getBreadcrumb(state) {
      return state.breadcrumb;
    },
  },
  modules: {
  }
})
